FROM golang:alpine as builder

WORKDIR /go/src/app

ENV GO111MODOLE=on

RUN go get github.com/caspare/reflex

COPY ../go.mod .
COPY ../go.sum .

RUN go mod download

COPY .. .

RUN go build -o ./run .

FROM alpine:latest
RUN apk --no-cache add ca-cartificates
WORKDIR /root/

COPY --from=builder /go/src/app/run .

EXPOSE 8080
CMD /"./run"/